package lanQiao;

public class X16ToX10
{
	public static void main(String[] a) throws Exception
	{
		long n=0;
		int t;
		
		while((t=System.in.read())!=13)
		{
			n=n*16+(t<65?t-48:t-55); 
		}
		
		System.out.println(n);
	}
}
